package com.yugao.fintech.antelope.shop.controller.admin;

import com.yugao.fintech.antelope.base.ram.ActionType;
import com.yugao.fintech.antelope.base.ram.RamResource;
import com.yugao.fintech.antelope.shop.model.rqrs.store.StoreTagListReq;
import com.yugao.fintech.antelope.shop.model.rqrs.store.StoreTagResp;
import com.yugao.fintech.antelope.shop.model.rqrs.store.StoreTagSaveReq;
import com.yugao.fintech.antelope.shop.model.rqrs.store.StoreTagUpdateReq;
import com.yugao.fintech.antelope.shop.service.StoreTagService;
import com.yugao.fintech.framework.core.response.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;

import java.util.List;

/**
 * 门店标签
 */
@Api(tags = "门店标签")
@RestController
@RequestMapping("/storeTag")
public class ShopStoreTagController {
    @Autowired
    private StoreTagService storeTagService;

    @ApiOperation(value = "查询门店标签")
    @GetMapping("/listStoreTag")
    @RamResource(action = "shopTag:tag:query", name = "查询门店标签", type = ActionType.READ)
    public Resp<List<StoreTagResp>> listStoreTag(@Validated StoreTagListReq req) {
        return Resp.ok(storeTagService.listStoreTag(req));
    }
  
    @ApiOperation(value = "保存门店标签")
    @PostMapping("/saveStoreTag")
    @RamResource(action = "shopTag:tag:save", name = "保存门店标签", type = ActionType.WRITE)
    public Resp<?> saveStoreTag(@Validated @RequestBody StoreTagSaveReq req) {
        return Resp.ok(storeTagService.saveStoreTag(req));
    }
  
    @ApiOperation(value = "更新门店标签")
    @PostMapping("/updateStoreTag")
    @RamResource(action = "shopTag:tag:update", name = "更新门店标签", type = ActionType.WRITE)
    public Resp<?> updateStoreTag(@Validated @RequestBody StoreTagUpdateReq req) {
        return Resp.ok(storeTagService.updateStoreTag(req));
    }
  
    @ApiOperation(value = "批量删除门店标签")
    @DeleteMapping("/batchDeleteStoreTag")
    @RamResource(action = "shopTag:tag:delete", name = "删除门店标签", type = ActionType.WRITE)
    public Resp<?> batchDeleteStoreTag(@RequestParam(value = "ids") List<Long> ids) {
        return Resp.ok(storeTagService.batchDeleteStoreTag(ids));
    }
  
    @ApiOperation(value = "删除门店标签")
    @DeleteMapping("/deleteStoreTag")
    @RamResource(action = "shopTag:tag:delete", name = "删除门店标签", type = ActionType.WRITE)
    public Resp<?> deleteStoreTag(@RequestParam(value = "id") Long id) {
        return Resp.ok(storeTagService.deleteStoreTag(id));
    }
}
